from django.urls import re_path, path
from . import views

urlpatterns = [
    # 用户名重复注册
    re_path(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    # 手机号重复注册
    re_path(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 注册
    re_path(r'^register/$', views.RegisterView.as_view()),
    # 登录
    re_path(r'^login/$', views.LoginView.as_view()),
    # 退出登录
    re_path(r'^logout/$', views.LogoutView.as_view()),
    # 用户中心
    re_path(r'^info/$', views.UserInfoView.as_view()),
    # 添加用户邮箱
    re_path(r'^emails/$', views.CreateEmailView.as_view()),
    # 用户邮箱验证
    re_path(r'^emails/verification/$', views.VerifyEmailView.as_view()),
    # 修改密码
    re_path(r'^password/$', views.UpdatePasswordView.as_view()),
    # 新增收货地址
    re_path(r'^addresses/create/$', views.CreateAddressView.as_view()),
    # 展示收货地址
    re_path(r'^addresses/$', views.ShowAddressView.as_view()),
    # 修改收货地址
    re_path(r'^addresses/(?P<address_id>\d+)/$', views.UpdateAddressView.as_view()),
    # 设置默认地址
    re_path(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view()),
    # 修改地址标题
    re_path(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateAddressTitleView.as_view()),
    # 用户浏览记录
    path('browse_histories/', views.UserBrowseHisteryView.as_view()),
]